/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */



function addService()
{
    $("#list_service").removeClass('span12');
    $("#list_service").addClass('span6');
    $("#form_service_add").show();
    $("#form_service_edit").hide();
}

function closeService()
{
    $("#list_service").removeClass('span6');
    $("#list_service").addClass('span12');
    $("#form_service_add").hide();
    $("#form_service_edit").hide();
}

function editService(el)
{
    $("#list_service").removeClass('span12');
    $("#list_service").addClass('span6');
    $("#form_service_add").hide();
    $("#form_service_edit").show();
    $.ajax({
        type: 'POST',
        url: el.attr('href')
    }).done(function(msg) {
        $("#form_service_edit").html(msg);
    });
    return false;
}

function deleteService(el)
{
    if (!confirm('Are you sure?'))
        return false;

    tag = el.parent().parent();

    url = el.attr('href');
    $.get(url, function(data) {
        if (data.err === 0)
        {
            tag.remove();
        }
        alert(data.msg);
    }, 'json');

    return false;
}